package com.zito.health.service.impl;

import com.zito.health.dto.LabListDto;
import com.zito.health.dto.LaboratoryDto;
import com.zito.health.entity.*;
import com.zito.health.mapper.*;
import com.zito.health.service.LabListService;
import com.zito.health.vo.LaboratoryCredentialsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.xml.crypto.Data;
import java.util.Date;
import java.util.List;

/**
 * @description:
 * @author: Sam
 * @time: 2020/03/01 15:57
 */
@Service
public class LabListServiceImpl implements LabListService {

    @Autowired
    private LaboratoryMapper laboratoryMapper;

    @Autowired
    private LaboratoryCredentialsMapper laboratoryCredentialsMapper;
    @Autowired
    private LaboratoryLinkmanMapper linkmanMapper;

    @Autowired
    private LaboratoryInchargeMapper inchargeMapper;

    @Autowired
    private LaboratorySystemMapper systemMapper;

    @Autowired
    private LaboratoryEquipmentMapper equipmentMapper;

    @Autowired
    private LaboratoryPersonnelMapper personnelMapper;

    @Autowired
    private LaboratoryActivity1Mapper activity1Mapper;

    @Autowired
    private LaboratoryActivity2Mapper activity2Mapper;

    @Autowired
    private LaboratoryPictureMapper pictureMapper;

    @Autowired
    private LaboratoryEquipmentMapper laboratoryEquipmentMapper;

    @Override
    public Laboratory save(Laboratory object) {
        int res = laboratoryMapper.insertSelective(object);
        return object;
    }

    @Override
    public void delete(Integer id) {
        laboratoryMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(Laboratory object) {
        laboratoryMapper.updateByPrimaryKeySelective(object);
    }

    @Override
    public List<Laboratory> query() {
        return laboratoryMapper.selectAll();
    }

    @Override
    public List<LabListDto> queryLabList(LabListDto object) {
        List<LabListDto> LabListDtos = laboratoryMapper.queryLabList(object);
        return LabListDtos;
    }

    @Override
    public List<Laboratory> query(Laboratory object) {
        return laboratoryMapper.select(object);
    }

    @Override
    public Laboratory queryOne(Laboratory object) {
        return laboratoryMapper.selectOne(object);
    }

    @Override
    public Laboratory queryById(Integer id) {
        Laboratory object = laboratoryMapper.selectByPrimaryKey(id);
        return object;
    }

    @Override
    public LaboratoryDto queryLaboratoryById(Integer id) {
        return laboratoryMapper.queryLaboratoryById(id);
    }

    @Override
    public boolean exists(Integer id) {
        return laboratoryMapper.existsWithPrimaryKey(id);
    }


    @Override
    @Transactional
    public int deleteById(Integer id) {
        return 0;
    }

    @Override
    public LaboratoryCredentialsVo queryCertificateByLabId(Integer laboratoryId) {
        return laboratoryCredentialsMapper.queryCertificateByLabId(laboratoryId);
    }



}
